<script setup>
import { onLaunch, onShow } from '@dcloudio/uni-app';
import { useUserStore, useCommonStore } from '@/store';

const userStore = useUserStore();
const commonStore = useCommonStore();

// 使用 uni-app 的应用生命周期
onLaunch(() => {
  console.log("App onLaunch");
  
  // 从本地存储初始化数据
  userStore.token = uni.getStorageSync('token') || "";
  userStore.userInfo = uni.getStorageSync('userInfo') || null;
  
  // 初始化 common store
  commonStore.initStateFromStorage();
  
  console.log('初始化完成，当前token：', userStore.token);
});

</script>

<style lang="scss">
/*每个页面公共css */
@import "uview-plus/index.scss";

/* 或者更具体的选择器 */
page,
view,
scroll-view,
swiper,
swiper-item,
input,
textarea {
  box-sizing: border-box;
}
</style>
